Skip to Content

Extending SDK Components

This document describes extension points available in the current SDK via local handlers.


Command extension with module routing

Use LocalCommandHandler to attach custom behavior per module name:

using Playserv.Server; using Playserv.Wrapper; public sealed class CreateMatchCommand { public string Region { get; set; } = "eu"; } var commandHandler = new LocalCommandHandler() .RegisterModule("server.match.create", command => { var create = (CreateMatchCommand)command; // Custom handling. }) .RegisterFallback((command, moduleName) => { // Optional fallback route. }); PlayServ.SetCommandHandler(commandHandler); PlayServ.Send(new CreateMatchCommand { Region = "eu" }, "server.match.create");

Event extension

For in-process event flow, register IEventHandler (for example LocalEventHandler):

  • custom publish behavior,
  • custom subscribe behavior,
  • optional integration with your own event bus.

RPC extension

Register local services through LocalRpcInvoker and route PlayServ.Invoke(...) calls in-process.


Behavior rules

  • If local handler handles call, SDK completes locally.
  • If local handler does not handle call and transport is connected, SDK falls back to transport.
  • If local handler does not handle call and transport is not connected, SDK throws explicit error.

Summary

In current SDK, component extension is handler-driven (ICommandHandler, IEventHandler, IRpcInvoker) and does not require modifying PlayServ runtime internals.

Last updated on